﻿<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/content.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>项目订制订单信息管理</title>
		<script>
		$(document).ready(function(){
			<c:forEach var="type" items="${order.types}">
			switch('${type}'){
			case '3':
				$("#c3").attr("checked", "checked");
				break;
			case '4':
				$("#c4").attr("checked", "checked");
				break;
			case '5':
				$("#c5").attr("checked", "checked");
				break;
			case '6':
				$("#c6").attr("checked", "checked");
				break;
			case '7':
				$("#c7").attr("checked", "checked");
				break;
			case '8':
				$("#c8").attr("checked", "checked");
				break;
			case '9':
				$("#c9").attr("checked", "checked");
				break;
			}
		</c:forEach>
		});	

		<script type="text/javascript">
		//离开页面提醒,有些浏览器不支持,如搜狗浏览器,很多很多
	    window.onbeforeunload = function(){
	    	if(isCommitted == false){
	    		return "即将离开页面，是否确认编辑的内容已使用并废弃？";
	        	}
	    }

	    jQuery.validator.addMethod("chcharacter",function(value,element){
	    	var tel = /^[\u4e00-\u9fa5]|[a-zA-Z ]+$/;
	        return this.optional(element) || (tel.test(value));
	    },"请输入正确的真实姓名");
	    jQuery.validator.addMethod("byteRangeLength", function(value, element, param) {
	        var length = value.length;
	        for(var i = 0; i < value.length; i++){
	            if(value.charCodeAt(i) > 127){
	                length++;
	            }
	        }
	        return this.optional(element) || ( length >= param[0] && length <= param[1] );
	    }, "请确保输入的值在3-15个字节之间(一个中文字算2个字节)");

	    jQuery.validator.addMethod("isPhone",function(value,element){
	    	var length = value.length;
//	        var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;//支持13 15 18开头
	        //支持13 15 18(056789)开头,同时支持xxx-xxxx-xxxx格式手机输入
	        var mobile = /^13\d{9}$|15\d{9}$|17\d{9}$|18\d{1}\d{8}|13\d{1}-\d{4}-\d{4}$|15\d{1}-\d{4}-\d{4}$|17\d{1}-\d{4}-\d{4}$|18\d{1}-\d{4}-\d{4}$/	
	        var result = this.optional(element) || (mobile.test(value));
	        if(result && mobile_send!=''){//发送过验证码之后
	        	if(mobile_send!=value){//手机号码不等于之前的手机号码的话
	        		$("#code").val("");
	        		result = "false";
	        	}
	        }
	        return result;
	    },"请填写正确的手机号码");

	    //验证  
	    $(document).ready(function(){
	        $("#orderForm").validate({
	            rules: {
	                'order.name': {
	                    required: true,
	                    chcharacter: true,
	                    byteRangeLength: [3,15]
	                },
	                'order.linkman': {
	                    required: true,
	                    isPhone: true//,
	                    //remote : '${ctx}/epMemberAction!checkMobile.action?orgMobile=&math='+Math.random()
	                }
	            } ,
	            messages:{
	                'order.name':{
	                    required: "*真实姓名不能为空",
	                    chcharacter: "*请输入正确的真实姓名",
	                    byteRangeLength: "*请确保输入的值在3-15个字节之间(一个中文字算2个字节)"
	                },
	                'order.linkman': {
	                    required: "*手机号码号码不能为空",
	                    isPhone: "*请输入正确的手机号码"//,
	                    //remote:"*该手机号已存在，请重新输入手机号码"
	                }
	            },
	            /* 之前的错误显示方法，也是alert */  
//	            errorPlacement : function(error, element) {
//	            		alert(error.html());
//	            },
	            /* 重写错误显示消息方法,以alert方式弹出错误消息 */  
	            showErrors: function(errorMap, errorList) {
	                var msg = "";  
	                $.each( errorList, function(i,v){
	                  msg += (v.message+"\r\n");  
	                });  
	                if(msg!="") alert(msg);  
	            }, 
	            onfocusout : false,/* 失去焦点时不验证 */  
	            onkeyup : false
	        });
	    });
	</script>
		</script>
	</head>
	<body>
		<div class="rhead">
			<div class="rpos">
				当前位置: 项目订制 - 订制订单 - 编辑项目订制订单
			</div>
			
			<div class="ropt">
				<input type="button" value="返回" onclick="history.back()" />
			</div>
			<div class="clear"></div>
		</div>
		<form action="authOrderAction!update.action" method="post" id="orderForm">
		<table align="center" class="listTable3" width="90%">
			<tr>
				<td class="pn-flabel" width="100px">
					序号
				</td>
				<td>
				<input type="hidden" name="order.id" value="${order.id}"/>
					${order.id}
				</td>
			</tr>
			<tr>
				<td class="pn-flabel">
					代理人
				</td>
				<td>
				<input type="text" name="order.name" value="${order.name}"/>
				</td>
			</tr>
			<tr>
				<td class="pn-flabel">
					代理人微信OpenID
				</td>
				<td>
				<input type="text" name="order.openId" value="${order.openId}" readonly="readonly" disabled="disabled"/>
				</td>
			</tr>
			<tr>
				<td class="pn-flabel">
					联系号码
				</td>
				<td>
				<input type="text" name="order.linkman" value="${order.linkman}" readonly="readonly" disabled="disabled"/>
				</td>
			</tr>
			<tr>
				<td class="pn-flabel">
					类型
				</td>
				<td>
					<input id="c3" type="checkbox" name="order.types" value="3"/>官网/微信公众号<br/>
					<input id="c4" type="checkbox" name="order.types" value="4"/>App和HTML5<br/>
					<input id="c5" type="checkbox" name="order.types" value="5"/>电子政务<br/>
					<input id="c6" type="checkbox" name="order.types" value="6"/>智慧物业<br/>
					<input id="c7" type="checkbox" name="order.types" value="7"/>P2P/众筹<br/>
					<input id="c8" type="checkbox" name="order.types" value="8"/>电商平台<br/>
					<input id="c9" type="checkbox" name="order.types" value="9"/>互联网+<br/>
				</td>
			</tr>
			<tr>
				<td class="pn-flabel">
					描述
				</td>
				<td>
				<textarea name="order.proDesc" placeholder="${order.proDesc}"  class="project-sub"></textarea>
					
				</td>
			</tr>
			<tr>
				<td class="pn-flabel">
					订制日期
				</td>
				<td>
					<fmt:formatDate value="${order.oderDate}" pattern="yyyy-MM-dd" />
				</td>
			</tr>
			<tr>
					<td colspan="2" style="text-align:center">
						<input type="submit" value=" 提 交 " />
					</td>
				</tr>
		</table>
		<br />
	</body>
</html>

